package org.devocean.groupbuying.domain;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Transient;

import org.springframework.web.multipart.commons.CommonsMultipartFile;

@SuppressWarnings("serial")
@Entity
public class Media implements Serializable {

	@Id
	@GeneratedValue
	private Integer mediaID;
	
	private String title;
	
	private String mediaFilePath;
	
	
	
	@Column(name="DESCRIPTION", columnDefinition="TEXT")
	private String description;
	
	private String mediaFileSize;
	
	private String mediaContentType;
	
	@Transient
	private CommonsMultipartFile fileData;

	@ManyToMany(mappedBy = "mediaLocalizations")
	private Set<ArticlesLocalization> articlesLocalizations = new HashSet<ArticlesLocalization>();
	
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "mc_localization", joinColumns = { @JoinColumn(name = "mediaID", referencedColumnName = "mediaID") }, inverseJoinColumns = { @JoinColumn(name = "categoriesLocalizationID", referencedColumnName = "categoriesLocalizationID") })
	private Set<CategoriesLocalization> categoriesLocalizations = new HashSet<CategoriesLocalization>();				

	public Integer getMediaID() {
		return mediaID;
	}

	public void setMediaID(Integer mediaID) {
		this.mediaID = mediaID;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getMediaFilePath() {
		return mediaFilePath;
	}

	public void setMediaFilePath(String mediaFilePath) {
		this.mediaFilePath = mediaFilePath;
	}

	public String getMediaFileSize() {
		return mediaFileSize;
	}

	public void setMediaFileSize(String mediaFileSize) {
		this.mediaFileSize = mediaFileSize;
	}


	public String getMediaContentType() {
		return mediaContentType;

	}

	public void setMediaContentType(String mediaContentType) {
		this.mediaContentType = mediaContentType;
	}

	public CommonsMultipartFile getFileData() {
		return fileData;
	}

	public void setFileData(CommonsMultipartFile fileData) {
		this.fileData = fileData;
	}

	public Set<ArticlesLocalization> getArticlesLocalizations() {
		return articlesLocalizations;
	}

	public void setArticlesLocalizations(
			Set<ArticlesLocalization> articlesLocalizations) {
		this.articlesLocalizations = articlesLocalizations;
	}
	
	

	public Set<CategoriesLocalization> getCategoriesLocalizations() {
		return categoriesLocalizations;
	}

	public void setCategoriesLocalizations(
			Set<CategoriesLocalization> categoriesLocalizations) {
		this.categoriesLocalizations = categoriesLocalizations;
	}

	

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	

}
